package com.example.demo.mapper;

import com.example.demo.pojo.QueryString;
import com.example.demo.pojo.Student;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("select *from student")
    Page<Student> list(QueryString querystring);

    void delete(List<Integer> ids);

    /**
     * 添加学生
     */
    @Insert("insert into student(name, no, gender, phone,id_card, is_college, address, degree, graduation_date,clazz_id, create_time, update_time) VALUES " +
            "(#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{createTime},#{updateTime})")
    void save(Student student);
    @Select("select *from student where id=#{id}")
    Student select(Integer id);
    void update(Student s);

    @Update("update student set violation_count = violation_count +1 , violation_score = violation_score +#{score},update_time = now() where id=#{id}")
    void right(Integer id,Integer score);
}
//    /**
//     * 违纪处理
//     */
//    @Update("update student set violation_count = violation_count + 1 , violation_score = violation_score + #{score} , update_time = now() where id = #{id}")
//    void updateViolation(Integer id, Integer score);
